#!/bin/bash
# vim: set ft=sh

set -e -x

export GOPATH=$PWD/concourse
export PATH=$PWD/concourse/bin:$PATH

# for Go on the Darwin worker
export PATH=/usr/local/bin:$PATH

final_version="$(cat final-version/version)"
platform="$(go env GOOS)"
arch="$(go env GOARCH)"

go build \
  -ldflags "-X github.com/concourse/fly/version.Version=${final_version}" \
  -o "${platform}-binary/fly_${platform}_${arch}" \
  github.com/concourse/fly
